
# 成功时返回的数据
def wrapSuccess(data):
    result = dict(code = 200, success = True, data = data)
    return result
    
# 失败时返回的数据
def wrapFailure(code, message):
    result = dict(code = code, success = False, message = message)
    return result

# 用于包装结点和相关边的数据
def wrapNodeAndRelationResult(node, relationships):
    result = {
        "node": node,
        "relationships": relationships
    }
    return result

# 用于包装每条边拆成结点和边的数据
def wrapRelationshipDivideData(start_node, end_node, relationship):
    result = {
        "start_node": start_node,
        "end_node": end_node,
        "relationship": relationship
    }
    return result

def wrapLtpItem(word, tag):
    result = {
        "word": word,
        "tag": tag
    }
    return result

def wrapKGQAData(answer, answerType, relationships = None):
    result = {
        "answer": answer,
        "answerType": answerType,
        "relationships": relationships
    }
    return result

# 专门用于包装区域节点相关信息
def wrapRegionDetailData(heros, node, relationships):
    result = {
        "heros": heros,
        "node": node,
        "relationships": relationships
    }
    return result